	<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
   	<%@page import="it.polimi.travelDream.ejb.servlet.*" %>
   	<%@page import="it.polimi.travelDream.entities.Package" %>
   <%@page import="it.polimi.travelDream.entities.*" %>
  	<jsp:useBean id="pmgr" class="it.polimi.travelDream.ejb.beans.PackageMgr" scope="session" />
  
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>
		  	TravelDreamLogin
		</title>
		<link rel="stylesheet" type="text/css" href="style.css" />
  	</head>
  
  <body>
  	<div class="header">
  		<ul>
	  		<li>TravelDream</li>
		    Search Packages
	    </ul>
  	</div>
  	
  	<div class="section">
  	 
	    <div class="nav">
	    	<ul>
	    		<li> <a href="UHome.jsp">Home</a></li>
	    		<li class="cur"> Search packages </li>
	    			<% if (request.getSession().getAttribute("utente")!=null )
		    	{ User z=(User)request.getSession().getAttribute("utente");
		    	out.println("<li><a href=/TravelDreamSystemWeb/ShowTravelList?travellistowner="+z.getId()+" >Travel List </a></li>"); 
		    	} %>
	    			 
	    	<% if (request.getSession().getAttribute("utente")!=null )
		    	{ User z=(User)request.getSession().getAttribute("utente");
		    	out.println("<li><a href=/TravelDreamSystemWeb/ShowWishList?wishlistowner="+z.getId()+" >Wish List </a></li>"); 
		    	} %>
	    		<li> <a href="UCart.jsp">Cart</a></li>
	    		<li><a href="SendMail.jsp">Invite To WishList</a></li>
	    		<li> <a href="SendMail2.jsp"> Invite to TravelList </a></li>
	    			<li> <a href="/TravelDreamSystemWeb/LogoutServlet?session=0"> Logout </a></li>
	    	</ul>
	    </div>
	    
	    <div class="content">
	     <% 
	      if (request.getSession().getAttribute("utente")!=null )
		    	{ User u=(User)request.getSession().getAttribute("utente");
		    		System.out.println("ciao"+u.getId());
		    	
	    
		    		%>
	    
	    <%  
        		int i = pmgr.showAllPackages().size() - 1;
				
        		while (i>=0) {
        			out.println("<div class=record>") ;

        			out.println("<div class=recordfield>") ;
        			out.println("<input class=fakeinput readonly=readonly type=text value="+pmgr.showAllPackages().get(i).getName()+" name=name />");
        			out.println("</div>") ;
        			   			
        			 			

        			out.println("<form action=UPackagePersonalize1.jsp method=POST >") ;
        			out.println("<input type=hidden value="+pmgr.showAllPackages().get(i).getID()+" name=idPackage />");
        			out.println("<input class=fakebutton type=submit value=Personalize />");
        			out.println("</form>");

        			
        			out.println("</div>");
        			i--;
	    			
        		}
    		%>
    		
    			   <% 
	    	if (request.getAttribute("message") == null) 
		    	{ 
		    		%>
						<div></div>
					<% 
				} 
	    	else 
		    	{ 
		    		%>
						<div class="advice"><%=request.getAttribute("message")%></div>
					<% 
				} 
		%>
		</div><%
		} else { 
				response.sendRedirect("/TravelDreamSystemWeb/login.jsp");
				%>
				
				
					<%
				}
		%>

    </div>
    
    <div class="footer">
    	<ul>
	    	<li>TravelDream Company srl © All rights reserved</li>
		    <li>Terms of use | Contacts | Team </li>
	    </ul>
    </div>
    
  </body>
</html>